Repository navigation
fix(mcpx/daemon): MaxBytesReader ceilings for the unbounded body readers (#2082) - #3370
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #2082 (queue task 5079; triage task 2968 pinned the route classes and error shape).
All 10 enumerated unbounded body readers in
pkgs/mcpx/internal/daemonnow read throughhttp.MaxBytesReaderat their route class's configured limit:routes_proxy.go), handleEmbeddings + handleEmbeddingsImport (routes_embeddings.go), handleExec (routes_exec.go), handleIntent + handleRecipeRun (routes_consumer.go)routes_consumer.go), handleFeedbackSubmit (routes_feedback.go), POST /v1/prompt (server.go)upgrade.go)One extra site found during implementation:
handleEmbeddingsImporthandedr.BodytoVectorIndex.Import, which decodes the whole body — also wrapped (callBodyLimit). The artifact upload keeps its store-bounded path (its 413 behaviour is untouched).Error shape matches the already-bounded routes: an over-limit body fails the decode and surfaces as 400 through each handler's existing error path; no status codes changed.
Limits resolve through a new
Server.bodyByteshelper (configured value, built-in default when the server has no settings set — the fallback shapehandleBatchalready used). Without it, the news.set.Bytes(...)calls nil-panicked in existing tests that construct a bare&Server{}(found by the full suite:TestHandleDiagnose_Validation). The pre-existinghandleCall/handleResource/handleRelease/handleRestartwraps were moved onto the same helper — identical behaviour with a settings set, nil-safe without one.Tests
New
body_limits_test.go:TestBodyLimitsRefuseOverLimit— over-limit bodies (limits overridden to 64B) refused with 400 + "request body too large" for chat completions, exec and intent; 400 for upgrade.TestBodyLimitsUnderLimitUnchanged— under-limit intent still reaches normal validation ("prompt is required").TestNoUnboundedBodyReaders— guard: fails if a non-test daemon source readsr.Bodywithout MaxBytesReader/LimitReader or the bounded artifact-store handoff.Verified on the laptop (fleet policy: no builds on the sandbox):
go vet ./internal/daemon/cleaninternal/daemonsuite passes (ok ... 129.719s)Need help on this PR? Tag
@codesmith-botwith what you need.